import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

# 创建一个新的3D图形
# fig = plt.figure()
# ax = fig.add_subplot(111, projection='3d')
#
# # 定义一些点的坐标
# points = [(1, 1, 1), (2, 3, 2), (3, 2, 1), (5, 5, 5), (6, 4, 1)]
#
# # 将点的坐标转换为numpy数组，以便matplotlib可以处理它们
# points_np = np.array(points)
#
# # 设置坐标轴的范围，使它们看起来等比例
# max_range = np.array([points_np[:, 0].max() - points_np[:, 0].min(),
#                       points_np[:, 1].max() - points_np[:, 1].min(),
#                       points_np[:, 2].max() - points_np[:, 2].min()]).max()
#
# Xb = 0.5 * max_range * np.mgrid[-1:2:2, -1:2:2, -1:2:2][0].flatten() + points_np[:, 0].min()
# Yb = 0.5 * max_range * np.mgrid[-1:2:2, -1:2:2, -1:2:2][1].flatten() + points_np[:, 1].min()
# Zb = 0.5 * max_range * np.mgrid[-1:2:2, -1:2:2, -1:2:2][2].flatten() + points_np[:, 2].min()
#
# # 设置坐标轴范围
# ax.set_xlim(points_np[:, 0].min() - 0.5 * max_range, points_np[:, 0].max() + 0.5 * max_range)
# ax.set_ylim(points_np[:, 1].min() - 0.5 * max_range, points_np[:, 1].max() + 0.5 * max_range)
# ax.set_zlim(points_np[:, 2].min() - 0.5 * max_range, points_np[:, 2].max() + 0.5 * max_range)
#
# ax.grid(False)
#
# # 添加坐标轴标签
# ax.set_xlabel('X')
# ax.set_ylabel('Y')
# ax.set_zlabel('Z')
#
# # 使用scatter方法绘制点
# ax.scatter(points_np[:, 0], points_np[:, 1], points_np[:, 2], c='red', marker='o')
#
# # 显示图形
# plt.show()

# a= np.exp(- 30 * 1 / 30) ** 10
# b= (np.exp(-300/30)) * 500
# print(a)
# print(b)



import numpy as np
import matplotlib.pyplot as plt

# 参数设置
a = 4   # 控制衰减速度
J = 100 # 最大值
j = np.arange(1, J+1)

# 函数计算
values = (250 * np.exp(-4 * j / J))
print(250 * np.exp(-4 * j / J))
print(np.random.normal(0, 1))

# 绘制曲线
plt.plot(j, values, label=r'$e^{-aj/J}$', color='blue')
plt.xlabel('j')
plt.ylabel('Value')
plt.title('Exponential Decay with j')
plt.legend()
plt.grid(True)
plt.show()
